#include "Model.h"
#include "StarlabException.h"
#include "ModelRenderer.h"

Model::Model(QString path, QString name){
    this->init();
    this->path = path;
    this->name = name.isEmpty() ? QFileInfo(path).baseName() : name;    
}

void Model::decorateLayersWidgedItem(QTreeWidgetItem* parent){
    QTreeWidgetItem *fileItem = new QTreeWidgetItem();
    fileItem->setText(1, QString("Path"));    
    fileItem->setText(2, this->path);
    parent->addChild(fileItem);
    // updateColumnNumber(fileItem);
}

void Model::setup(QMenu *modelMenu, QToolBar *modelToolbar){
    // if(!renderer()->ready()) return;
    QActionGroup* modes = renderer()->renderModes();
    modelToolbar->addActions(modes->actions());

    QMenu* subMenu = modelMenu->addMenu("RenderMode");
    subMenu->addActions(modes->actions());
}

ModelRenderer* Model::renderer(){
    if(_renderer==NULL)
        _renderer = _defaultRenderer;
    return _renderer;
}



